package top.zhangjianyong.test.thread;

public class TRunnable implements Runnable {

    private volatile Integer i =0 ;

    @Override
    public  void run() {
            for (int j=0;j<10;j++){
                add();
                printI();
            }
    }


    public   void add(){
        i++;
    }

    public void printI(){
        System.out.println("i:"+i);
    }

    public static void main(String[] args) {
        TRunnable tRunnable =new TRunnable();

        for (int  i=0;i<100;i++){
            Thread thread =new Thread(tRunnable);
            thread.start();
        }


    }
}
